import LayoutAdmin from '@/layout/backend/index.vue'

const routes = [
  // 后台使用
  {
    path: '/dashboard',
    component: LayoutAdmin,
    children: [
      {
        path: '',
        name: 'Dashboard',
        component: () => import('@/views/backend/dashboard/index.vue'),
        meta: { title: '控制台', icon: 'HomeFilled', roles: ['dashboard'], addtab: true, keepalive: 'Dashboard' }
      }
    ]
  },
  {
    path: '/addons',
    component: LayoutAdmin,
    redirect: 'noRedirect',
    meta: { title: '应用', icon: 'el-icon-s-tools', roles: ['addons-index', 'founder'] },
    children: [
      {
        path: '/addons/list',
        name: 'addons_list',
        component: () => import('@/views/backend/addons/list/index.vue'),
        meta: { title: '应用列表', roles: ['addons-list', 'founder'], addtab: true, keepalive: 'AddonsList' }
      },
      {
        path: '/addons/install/:name',
        name: 'addons_install',
        component: () => import('@/views/backend/addons/install/Index.vue'),
        meta: { title: '应用安装', roles: ['addons-install', 'founder'] }
      }
    ]
  },
  {
    path: '/platform',
    component: LayoutAdmin,
    redirect: 'noRedirect',
    meta: { title: '平台', icon: 'el-icon-s-tools', roles: ['platform-index', 'founder'] },
    children: [
      {
        path: '/platform/list',
        name: 'platform_platform_list',
        component: () => import('@/views/backend/platform/list.vue'),
        meta: { title: '平台列表', roles: ['platform-index', 'founder'], addtab: true, keepalive: 'PlatformList' }
      }
    ]
  },
  {
    path: '/setting',
    component: LayoutAdmin,
    redirect: 'noRedirect',
    meta: { title: '系统设置', icon: 'el-icon-s-tools', roles: ['setting-index', 'founder'] },
    children: [
      {
        path: '/setting/menu',
        name: 'setting_menu',
        component: () => import('@/views/backend/setting/menu/index.vue'),
        meta: { title: '菜单管理', roles: ['setting-menu', 'founder'], addtab: true, keepalive: 'SettingMenu' }
      },
      {
        path: '/setting/config',
        name: 'setting_config',
        component: () => import('@/views/backend/setting/config/index.vue'),
        meta: { title: '基础设置', roles: ['setting-config', 'founder'], addtab: true, keepalive: 'SettingConfig' }
      }
    ]
  },
  {
    path: '/open',
    component: LayoutAdmin,
    redirect: 'noRedirect',
    meta: { title: '服务商', icon: 'el-icon-s-tools', roles: ['open-index', 'founder'] },
    children: [
      {
        path: '/open/douyin',
        name: 'open_douyin',
        component: () => import('@/views/backend/open/douyin.vue'),
        meta: { title: '抖音小程序', roles: ['open-douyin', 'founder'], addtab: true, keepalive: 'OpenDouyin' }
      },
      {
        path: '/open/wechat_mini',
        name: 'open_wechat_mini',
        component: () => import('@/views/backend/open/wechatMini.vue'),
        meta: { title: '微信小程序', roles: ['open-wechat_mini', 'founder'], addtab: true, keepalive: 'OpenWechatMini' }
      },
      {
        path: '/open/wechat',
        name: 'open_wechat',
        component: () => import('@/views/backend/open/wechat.vue'),
        meta: { title: '微信公众号', roles: ['open-wechat', 'founder'], addtab: true, keepalive: 'OpenWechat' }
      },
      {
        path: '/open/work_wechat',
        name: 'open_work_wechat',
        component: () => import('@/views/backend/open/workWechat.vue'),
        meta: { title: '企业微信', roles: ['open-work_wechat', 'founder'], addtab: true, keepalive: 'OpenWorkWechat' }
      }
    ]
  },
  {
    path: '/cloud',
    component: LayoutAdmin,
    redirect: 'noRedirect',
    meta: { title: '云服务', icon: 'el-icon-s-tools', roles: ['cloud', 'founder'] },
    children: [
      {
        path: '/cloud/index',
        name: 'cloud-index',
        component: () => import('@/views/backend/cloud/index/index.vue'),
        meta: { title: '云服务', roles: ['cloud-index', 'founder'], addtab: true, keepalive: 'CloudIndex' }
      },
      {
        path: '/cloud/upgrade',
        name: 'cloud-upgrade',
        component: () => import('@/views/backend/cloud/upgrade/index.vue'),
        meta: { title: '系统升级', roles: ['cloud-upgrade', 'founder'], addtab: true, keepalive: 'CloudUpgrade' }
      }
    ]
  },
  {
    path: '/user',
    meta: { title: '用户管理' },
    component: LayoutAdmin,
    redirect: 'noRedirect',
    children: [
      {
        path: '/user/list',
        name: 'user_index',
        component: () => import('@/views/backend/user/list.vue'),
        meta: { title: '用户管理', roles: ['user-list', 'founder'], addtab: true, keepalive: 'UserList' }
      },
      {
        path: '/user/group',
        name: 'user_group',
        component: () => import('@/views/backend/user/group.vue'),
        meta: { title: '管理组', roles: ['user-group', 'founder'], addtab: true, keepalive: 'UserGroup' }
      },
      {
        path: '/user/addon_group',
        name: 'user_addon_group',
        component: () => import('@/views/backend/user/addon_group.vue'),
        meta: { title: '应用组', roles: ['user-addon-group', 'founder'], addtab: true, keepalive: 'UserAddonGroup' }
      }
    ]
  }
  // {
  //   path: '/plugin',
  //   component: LayoutAdmin,
  //   children: [{
  //     path: '',
  //     name: 'Plugin',
  //     component: () => import('@/views/backend/plugin/index'),
  //     meta: { title: '插件管理', icon: 'dashboard', roles: ['dashboard'] }
  //   }]
  // }
]
export default routes
